#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	double x;
	int yue, ri,f;
	scanf("%lf %d %d %d", &x, &yue, &ri, &f);
	if (yue == 11 && ri == 11)
	{
		if (f == 1) printf("%.2lf", x * 0.75 - 75);
		else printf("%.2lf", x * 0.75);
	}
	if (yue == 12 && ri == 12)
	{
		if (f == 1) printf("%.2lf", x * 0.85 - 75);
		else printf("%.2lf", x * 0.85);
	}
	return 0;
}
